package com.test.io;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class BufferedInputFile {
	public static final String PATH = "E:/Android/workspace/Test/src/com/test/io/";
	public static void main(String[] args) throws IOException {
		System.out.println(read("BufferedInputFile.java"));
	}

	/**
	 * read file by lines
	 * 
	 * @param filename
	 * @return String
	 * @throws IOException
	 */
	public static String read(String filename) throws IOException {
		// read iput by lines
		BufferedReader in = new BufferedReader(new FileReader(PATH+filename));
		String s;
		StringBuilder sb = new StringBuilder();
		while ((s = in.readLine()) != null) {
			sb.append(s + "\n");
		}
		in.close();
		return sb.toString();
	}
}
